package com.apes.fn.mdm.offer.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.frame.model.Dept;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = DeptOfferGroup.CONST_TABLE_NAME)
public class DeptOfferGroup extends Model {
    public static final String CONST_TABLE_NAME = "mas_dept_offer_group";

    @Id
    @Column(name = "id", length = 4)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "报价组",padding = 4)
    @Comment("编码")
    private String id;

    @Column(name = "name", length = 128)
    @Comment("报价组")
    private String name;


    @Comment("门店")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dept_id", referencedColumnName = "id")
    private Dept dept;






}
